package com.tairanchina.joat;

import com.tairanchina.joat.exception.JoatExecuteException;
import com.tairanchina.joat.exception.JoatLifecycleException;

/**
 * Created by 周靖捷 on 2016/10/16.
 */
public abstract class FilterPlugin implements Plugin {
    final FilterPluginChain filterPluginChain;

    protected FilterPlugin(FilterPluginChain filterPluginChain) {
        this.filterPluginChain = filterPluginChain;
    }

    public Object execute(PluginVariable variable, PluginEnvironment environment) throws JoatExecuteException {
        return filter(variable, environment, filterPluginChain);
    }

    public abstract Object filter(PluginVariable variable, PluginEnvironment environment, FilterPluginChain filterPluginChain) throws JoatExecuteException;

    public void init() throws JoatLifecycleException {

    }

    public void load() throws JoatLifecycleException {

    }

    public void run() throws JoatLifecycleException {

    }

    public void disable() {

    }

    public void enable() {

    }

    public void stop() throws JoatLifecycleException {

    }

    public void destroy() throws JoatLifecycleException {

    }
}
